/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.order.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import me.zhengjie.base.BaseEntity;

import javax.persistence.*;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.io.Serializable;

/**
*
* @description /
* @author maojinhui
* @date 2020-09-08
**/
@Entity
@Data
@Table(name="sys_wechat_order")
public class WechatOrder extends BaseEntity implements Serializable {

    @Id
    @Column(name = "id")
    @ApiModelProperty(value = "订单号")
    private String id;

    @Column(name = "user_id")
    @ApiModelProperty(value = "用户id")
    private String userId;

    @Column(name = "attach")
    @ApiModelProperty(value = "发布类型")
    private String attach;

    @Column(name = "attach_id")
    @ApiModelProperty(value = "发布类型对应的id")
    private Long attachId;

    @Column(name = "publish_money_id")
    @ApiModelProperty(value = "发布时间对应的id")
    private Integer publishMoneyId;

    @Column(name = "body")
    @ApiModelProperty(value = "订单信息")
    private String body;

    @Column(name = "total_fee")
    @ApiModelProperty(value = "总支付金额（单位：分）")
    private Integer totalFee;

    @Column(name = "trade_type")
    @ApiModelProperty(value = "交易类型")
    private String tradeType;

    @Column(name = "spbill_create_ip")
    @ApiModelProperty(value = "发起支付ip")
    private String spbillCreateIp;

    @Column(name = "status")
    @ApiModelProperty(value = "订单状态0:待支付；-1.支付失败，1支付成功")
    private Integer status;

    @Column(name = "transaction_id")
    @ApiModelProperty(value = "微信支付订单号")
    private String transactionId;

    @Column(name = "end_time")
    @ApiModelProperty(value = "支付完成时间")
    private String endTime;

    public void copy(WechatOrder source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}